﻿////////////////////////////////////////////////////////////////////////
// Module           : HybridClockExt.js
// Description      : Hybrid Clock Digital Extension
// Developer        : Alexander Bell, USA (www.alexanderbell.us)
// Copyright(C)     : 2008 Alexander Bell
// Version          : V.2.03
// Note             : Created/optimized for Microsoft Silverlight 2.0
// Revision History:
// 10/18/2008 - Microsoft silverlight clock 1.0 digital enhancement
// 12/04/08 - bug fix
////////////////////////////////////////////////////////////////////////


// this module adds digital Time/Date to analog Silverlight clock
// in order to operate itrequires DateTime.js script file loaded

var _tProcID;    // update Time process ID
var _senderTime; // Time sender object
var _dProcID;    // update Date process ID
var _senderDate; // Date sender object

// dynamic Time on Silverlight clock
function digiTimeSilverlight(sender, eventArgs) {
    try  {
        _senderTime = sender;
        _tProcID = window.setInterval('dTimeSilverlightUpdate()', 1000);
    } catch (e) { }
}

function dTimeSilverlightUpdate() {
    try { _senderTime.Text = DateAndTime('', 't', '', '', '', ''); } 
    catch (e) { }
}

// dynamic Date on Silverlight clock
function digiDateSilverlight(sender, eventArgs) {
    try {
        _senderDate = sender;
        _dProcID = window.setInterval('dDateSilverlightUpdate()', 1000);
    } catch (e) { }
}

function dDateSilverlightUpdate() {
    try { _senderDate.Text = DateAndTime('d', '', '', '', '', ''); } 
    catch (e) { }
}

// stop Silverlight digital enhancement: both Time and Date
function StopSilverLightDigitalTimeDate() {
    try { window.clearInterval(_dProcID); } catch (e) { }
    try { window.clearInterval(_tProcID);} catch (e) { }
}

////////////////////////////////////////////////////////////////////////